{extend name='admin@main'}

{block name="content"}

{include file='android/form_style'}

<form onsubmit="return false;" id="GoodsForm" data-auto="true" method="post" class='layui-form layui-card res_field_form' lay-filter="form_sub" autocomplete="off">

    <div class="layui-card-body think-box-shadow padding-left-40">

        <div class="layui-form-item layui-row layui-col-space15">
                <span class="color-green label-required-prev">安卓版本号</span>
                <input name="android_sn"  type="number"{if $isAddMode eq 0}readonly{/if} required class="layui-input" placeholder="请输入安卓版本号" value="{$vo.android_sn|default=''}">
        </div>

        <div class="layui-form-item layui-row layui-col-space15" id="video">
            <label class="col-sm-2 color-green label-required-prev control-label">上传安卓apk包</label>
            <div class='col-sm-8'>
                <div class="row">
                    <div class="col-sm-10 padding-right-0">
                        <input  style="border-right:none" name="link" required value="{$vo.link|default=''}" class="layui-input" title="请输入安卓apk链接或上传安卓apk展示文件" placeholder="请输入安卓apk链接或上传安卓apk展示文件">
                    </div><br>
                    <div class="col-sm-2 padding-left-0">
                        <button data-file="one" data-type="apk,aab" data-field="link" type="button" class="layui-btn layui-btn-sm" style="height:38px;line-height:38px">上传安卓apk文件</button>
                    </div>
                </div>
            </div>
        </div>

        <div class="layui-form-item block">
            <span class="label-required-prev color-green">是否开放下载</span>
            {if isset($vo.is_open)}
            <input type="radio" name="is_open" value="0" title="否" lay-filter="is_open" {if $vo.is_open eq 0}checked{/if}>
            <input type="radio" name="is_open" value="1" title="是" lay-filter="is_open" {if $vo.is_open eq 1}checked{/if}>
            {else}
            <input type="radio" name="is_open" value="0" title="否" lay-filter="is_open" checked>
            <input type="radio" name="is_open" value="1" title="是" lay-filter="is_open">
            {/if}
        </div>

        <div class="layui-form-item text-center">
            <input type="hidden" name="isAddMode" value="{$isAddMode}">
            {notempty name='vo.id'}<input type="hidden" name="id" value="{$vo.id}">{/notempty}
            <button class="layui-btn layui-btn-danger" ng-click="hsitoryBack()" type="button">取消</button>
            <button class="layui-btn" type="submit">保存</button>
        </div>

    </div>
</form>
{/block}

{block name='script'}
<textarea class="layui-hide" id="goods-specs">{$vo.specs|raw|default=''}</textarea>
<textarea class="layui-hide" id="goods-value">{$defaultValues|raw|default=''}</textarea>
<script>
    window.form.render();
    require(['ckeditor', 'angular'], function () {
        var app = angular.module("GoodsForm", []).run(callback);
        angular.bootstrap(document.getElementById(app.name), [app.name]);

        function callback($rootScope) {
            $rootScope.isAddMode = parseInt('{$isAddMode|default=0}');
            // 返回项目列表
            $rootScope.hsitoryBack = function () {
                $.msg.confirm('确定要取消编辑吗？', function (index) {
                    history.back(), $.msg.close(index);
                });
            };

        }
    })
</script>

{/block}